#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
using namespace std;

int main() {
    int a = 0, b = 0;
    cin >> a >> b;
    char table[100][100];
    int i = 0;
    int j = 0;
    for (i = 0; i < a; i++)
    {
        for (j = 0; j < b; j++)
        {
            cin >> table[i][j];
        }
        getchar();
    }

    vector<vector<int>>dp(a + 1, vector<int>(b + 1, 0));
    int maxRes = 0;

    for (i = 1; i < a + 1; i++)
    {
        for (j = 1; j < b + 1; j++)
        {
            int res = 0;
            if (table[i - 1][j - 1] == 'l')
            {
                res = 4;
            }
            else if (table[i - 1][j - 1] == 'o')
            {
                res = 3;
            }
            else if (table[i - 1][j - 1] == 'v')
            {
                res = 2;
            }
            else if (table[i - 1][j - 1] == 'e')
            {
                res = 1;
            }
            else
            {
                res = 0;
            }
            dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) + res;
            maxRes = max(maxRes, dp[i][j]);
        }

    }

    cout << maxRes;


}